#!/usr/bin/env python
# coding: utf-8

# 编写一个函数来计算5/0并使用try/except来捕获异常，当错误为ZeroDivisionError时打印`division by zero`，且无论是否报错最后均打印`无论对错都执行finally`。
#
# 预期输出：
# `division by zero`
# `无论对错都执行finally`

# In[1]:


def divide():
    return 5 / 0
try:
    divide()
except ZeroDivisionError as ze:
    print("division by zero")
finally:
    print("无论对错都执行finally")


# In[2]:


def divide():
    return 5 / 0
try:
    divide()
except ZeroDivisionError as ze:
    print("division by zero")
except:
    print("无论对错都执行finally")


# In[ ]:




